#include <bits/stdc++.h>
using std::bitset;
using std::cout;
using std::deque;
using std::endl;
using std::greater;
using std::lower_bound;
using std::make_pair;
using std::map;
using std::max;
using std::min;
using std::multimap;
using std::multiset;
using std::nth_element;
using std::pair;
using std::priority_queue;
using std::queue;
using std::reverse;
using std::set;
using std::sort;
using std::sqrt;
using std::stable_sort;
using std::string;
using std::swap;
using std::unique;
using std::upper_bound;
using std::vector;
using namespace std;
typedef long long li;
typedef long double lf;

inline li read() {
    li ans = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        f = (ch == '-') ? -1 : 1;
        ch = getchar();
    }
    while (ch <= '9' && ch >= '0') {
        ans = ans * 10 + (ch ^ 48);
        ch = getchar();
    }
    return ans * f;
}

li n, m;
li f1[500010], vis[500010], f2[500010], p[500010], lenp;
li& F(li x) { return x > m ? f2[n / x] : f1[x]; }
li sf[500010];

li S(li n, li k) {
    if (n <= p[k])
        return 0;
    li ret = F(n) - sf[k];
    for (li i = k + 1; i <= lenp && p[i] * p[i] <= n; i++) {
        li pk = p[i];
        for (li c = 1; pk * p[i] <= n; c++, pk *= p[i]) {
            ret += 1 * S(n / pk, i);
        }
    }
    //	printf("S %lld %lld = %lld\n", n, k, ret);
    return ret;
}

int main() {
    //	freopen("wonderful.ans", "r", stdin);
    //	freopen("www.ww", "w", stdout);
    m = sqrtl(n = read());
    for (li i = 2; i <= m; i++) {
        if (!vis[i]) {
            p[++lenp] = i;
            for (li j = i + i; j <= m; j += i) vis[j] = 1;
            sf[lenp] = sf[lenp - 1] + 1;
        }
    }
    for (li l = 1, r; l <= n; l = r + 1) {
        r = min(n, n / (n / l));
        F(n / l) = n / l;
    }
    for (li j = 1; j <= lenp; j++) {
        for (li l = 1, r; l <= n; l = r + 1) {
            r = min(n, n / (n / l));
            if (n / l < p[j] * p[j])
                break;
            li x = n / l;
            F(x) = (F(x) - 1 * (F(x / p[j]) - sf[j - 1] - 1));
        }
    }
    //	for(li l = 1, r; l <= n; l = r + 1){
    //		r = min(n, n / (n / l));
    //		printf("f %lld = %lld\n", n / l, F(n / l));
    //	}
    printf("%lld\n", F(n) - 1);
    return 0;
}